package com.itheima.iostream;


import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

/*
 * FileReader:字符输入流，只能读取普通文本文件，不能读取图片、音频、视频等文件
 */
public class FileReader01 {
    public static void main(String[] args) {
        FileReader fileReader = null;
        try{
            fileReader =new FileReader("src\\com\\itheima\\iostream\\myfile");

            char[] readBytes = new char[4];
            int readCount =0;
            while((readCount = fileReader.read(readBytes))!=-1){
                System.out.println(new String(readBytes,0,readCount));
            }


        }catch(FileNotFoundException e){
            e.printStackTrace();
        }catch(IOException e){
            e.printStackTrace();
        }finally{
            if(fileReader!=null){
                try {
                    fileReader.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }



    }

}
